<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var str = 'aobcodefoogohijkol'
      var shu = {}
      for (i = 0; i < str.length; i++) {
        var s = str.charAt(i)
        if (shu.hasOwnProperty(s)) {
          shu[s]++
        } else {
          shu[s] = 1
        }
      }
      console.log(shu)
    </script>
  </body>
</html>
